package com.tjpu.xj.controller;

import java.io.PrintWriter;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.tjpu.xj.beans.ProjectBean;
import com.tjpu.xj.beans.StudentBean;
import com.tjpu.xj.bll.StudentBLL;

/**
 * 学生控制器
 * 
 * @author chen
 *
 */
@Controller
@Scope("prototype")
@RequestMapping("student")
public class StudentController {

	@Resource
	private StudentBLL studentBLL;

	/**
	 * 登录
	 * 
	 * @param student
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "login", method = RequestMethod.POST)
	public String login(@ModelAttribute StudentBean student, Model model) {
		//写入Cookie["id",studentCode],为了后边展示列表
		return "";
	}

	/**
	 * 修改真实姓名
	 * 
	 * @param student
	 * @param pw
	 * @return
	 */
	@RequestMapping(value = "updateRealName", method = RequestMethod.POST)
	public void setOrUpdateRealName(@ModelAttribute StudentBean student,
			PrintWriter pw) {

	}

	/**
	 * 修改密码
	 * 
	 * @param student
	 * @param pw
	 * @return
	 */
	@RequestMapping(value = "setPassword", method = RequestMethod.POST)
	public void updatePassword(@ModelAttribute StudentBean student,
			PrintWriter pw) {

	}

	/**
	 * 上传项目
	 * 
	 * @param student
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "uploadProject", method = RequestMethod.POST)
	public String uploadProject(@ModelAttribute ProjectBean project, Model model) {
		return "";// 上传成功
	}

	/**
	 * 展示项目，根据学生的主键
	 * @param studentCode
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "project", method = RequestMethod.GET)
	public String getProjects(@CookieValue("id") String studentCode, Model model) {
		return "";//展示项目的列表
	}

}
